import { IM } from "src/assets/electron";
import { parseCookie } from "src/assets/utils";

export function accounts(state) {
  let list = [];
  for (const id in state.accounts) {
    if (Object.hasOwnProperty.call(state.accounts, id)) {
      const v = state.accounts[id];
      if (!!v.userid && !!v.cookie && !!v.enable) {
        list.push(v);
        const cookie = parseCookie(v.cookie);
        IM.login(cookie.data);
        // IM.test(cookie.data);
      }
    }
  }
  return list;
}
